<%--
  Created by IntelliJ IDEA.
  User: 飞蓬
  Date: 2017/7/29
  Time: 0:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <jsp:include page="../js_top.jsp"></jsp:include>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
        .table_report{width:520px;margin:15px auto;}

        .table_report tr td:nth-child(2n+1){width:130px;text-align:right;line-height:31px;color:#63666d;font-size:14px;font-family:Arial,Helvetica,"微软雅黑";}
        .table_report tr td:nth-child(2n){width:100px;line-height:31px;color:#63666d;font-size:14px;font-family:Arial,Helvetica,"微软雅黑";}
        .table_report tr td a{width:185px;height:38px;line-height:38px;-webkit-border-radius:5px;border-radius:5px;border-color:#b7bacb;display:block;font-size:14px;font-family:"微软雅黑";text-shadow:0 0px 0 rgba(0,0,0,0)!important;background:#b7bacb url(/static/img/images/table_report_icon1.png) no-repeat 70px center;text-align:center;color:#fff;cursor:pointer;text-indent:20px;float:left;margin:0 20px 0 0;}

        .table_report tr td a:hover,.table_report tr:last-child td:last-child a:hover{background-color:#0fb1d6;text-decoration:none;}
        input:focus:invalid:focus, textarea:focus:invalid:focus, select:focus:invalid:focus{border-color:#f59942;}
    </style>
    <title>修改密码</title>

</head>

<body>
<form action="sys/sysAccount/editPassword.do" id="editPasswordForm" name="editPasswordForm" method="post">

    <table class="table  table-striped table-hover table_report">
        <tr>
            <td>原密码:</td>
            <td><input type="text" name="oldPassword" id="oldPassword"  placeholder="必填"  required="true"/></td>
        </tr>
        <tr>
            <td>新密码:</td>
            <td><input type="text" name="newPassword" id="newPassword"  placeholder="必填" required="true"/></td>
        </tr>
        <tr>
            <td>密码确认:</td>
            <td><input type="text" name="newPassword2" id="newPassword2"  placeholder="必填" required="true"/></td>
        </tr>
        <tr>
            <td colspan="10">
                <a  style="margin-left: 66px"  href="javascript:editPassword();">确定</a>
                <a href="javascript:top.Dialog.close();">取消</a>
            </td>
        </tr>
    </table>
</form>
</body>

<script type="text/javascript">
    function editPassword(){
        var oldPassword = $('#oldPassword').val();
        var newPassword = $('#newPassword').val();
        var newPassword1 = $('#newPassword2').val();


        if(newPassword != newPassword1){
            $('#newPassword').val("");
            $('#newPassword2').val("");
            $('#newPassword').tips({
                msg:'输入的两个密码不同！',
                side:3,
                time:3
            });
            $('#newPassword').focus();
            return false;
        }

        if(newPassword.length<6){
            $('#newPassword').val("");
            $('#newPassword2').val("");
            $('#newPassword').tips({
                msg:'输入的新密码长度要大于6位！',
                side:3,
                time:3
            });
            $('#newPassword').focus();
        }
        var url = "sys/sysAccount/editPassword.do";
        var postData = {
            "newPassword":newPassword,
            "oldPassword":oldPassword
        };

        $.post(url,postData,function(data){
           if(data == "true"){
               layer.msg("修改成功！");
           }else{
               layer.msg("输入的原密码有误！修改失败！");
           }
        });


    }
</script>
</html>
